package com.usian.admin.controller;

import com.usian.admin.service.AdSensitiveService;
import com.usian.api.admin.AdSensitiveControllerApi;
import com.usian.model.admin.dtos.SensitiveDto;
import com.usian.model.admin.pojos.AdSensitive;
import com.usian.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("api/v1/sensitive")
public class AdSensitiveController implements AdSensitiveControllerApi {
    @Autowired
    private AdSensitiveService adSensitiveService;

    /**
     * 敏感词查询
     * @param dto
     * @return
     */
    @Override
    @PostMapping("list")
    public ResponseResult list(@RequestBody SensitiveDto dto) {
        return adSensitiveService.list(dto);
    }

    /**
     * 敏感词添加
     * @param adSensitive
     * @return
     */

    @Override
    @PostMapping("save")
    public ResponseResult save(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.insert(adSensitive);
    }

    /**
     * 敏感词修改
     * @param adSensitive
     * @return
     */
    @Override
    @PostMapping("update")
    public ResponseResult update(@RequestBody AdSensitive adSensitive) {
        return adSensitiveService.update(adSensitive);
    }

    /**
     * 敏感词删除
     * @param id
     * @return
     */
    @Override
    @DeleteMapping("del/{id}")
    public ResponseResult del(@PathVariable Integer id) {
        return adSensitiveService.delete(id);
    }
}
